package main

import (
	"os"
	"io"
	"bufio"
	"fmt"
)

func main(){
	filePath1 := "../1.jpg"
	filePath2 := "../2.jpg"
	Copy(filePath1,filePath2)
}
func Copy(srcPath string,dstPath string) int64{
	file1,_ := os.Open(srcPath)
	defer file1.Close()
	file2,_ := os.OpenFile(dstPath,os.O_WRONLY|os.O_TRUNC|os.O_CREATE,0666)
	defer file2.Close()
	reader := bufio.NewReader(file1)
	writer := bufio.NewWriter(file2)
	written,err := io.Copy(writer,reader)
	if err != nil {
		fmt.Println(err)
	}
	return written
}
